package com.cjkj.equipment.service.impl;

import com.cjkj.common.utils.DateUtils;
import com.cjkj.equipment.domain.EquipmentMonitorRecordsRealtime;
import com.cjkj.equipment.mapper.EquipmentMonitorRecordsRealtimeMapper;
import com.cjkj.equipment.service.IEquipmentMonitorRecordsRealtimeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 设备实时数据记录Service业务层处理
 * 
 * @author cjkj
 * @date 2024-08-15
 */
@Service
public class EquipmentMonitorRecordsRealtimeServiceImpl implements IEquipmentMonitorRecordsRealtimeService
{
    @Resource
    private EquipmentMonitorRecordsRealtimeMapper equipmentMonitorRecordsRealtimeMapper;

    @Override
    public EquipmentMonitorRecordsRealtime getByProductIdAndEquipmentNo(String productId, String equipmentNo) {
        return equipmentMonitorRecordsRealtimeMapper.selectByProductIdAndEquipmentNo(productId, equipmentNo);
    }

    @Override
    public EquipmentMonitorRecordsRealtime getRealtimeData(String equipmentNo) {
        return equipmentMonitorRecordsRealtimeMapper.selectRealtimeData(equipmentNo);
    }

    /**
     * 新增设备实时数据记录
     * 
     * @param equipmentMonitorRecordsRealtime 设备实时数据记录
     * @return 结果
     */
    @Override
    public int insertEquipmentMonitorRecordsRealtime(EquipmentMonitorRecordsRealtime equipmentMonitorRecordsRealtime)
    {
        equipmentMonitorRecordsRealtime.setCreateTime(DateUtils.getNowDate());
        return equipmentMonitorRecordsRealtimeMapper.insertEquipmentMonitorRecordsRealtime(equipmentMonitorRecordsRealtime);
    }

    /**
     * 修改设备实时数据记录
     * 
     * @param equipmentMonitorRecordsRealtime 设备实时数据记录
     * @return 结果
     */
    @Override
    public int updateEquipmentMonitorRecordsRealtime(EquipmentMonitorRecordsRealtime equipmentMonitorRecordsRealtime)
    {
        equipmentMonitorRecordsRealtime.setUpdateTime(DateUtils.getNowDate());
        return equipmentMonitorRecordsRealtimeMapper.updateEquipmentMonitorRecordsRealtime(equipmentMonitorRecordsRealtime);
    }

}
